package com.qf.hsr.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.hsr.common.ResultVO;
import com.qf.hsr.dao.IAccountMapper;
import com.qf.hsr.pojo.Account;
import com.qf.hsr.service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author q
 * @version V1.0
 * @date 2021/11/11
 **/
@Service
@Transactional
public class AccountServiceImpl implements IAccountService {

    @Autowired
    private IAccountMapper accountMapper;

    @Override
    public ResultVO<PageInfo<Account>> findByPage(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Account> allAccount = accountMapper.findAll();
        PageInfo<Account> pageAccount = new PageInfo<>(allAccount);
        return ResultVO.ok("账户查询成功~",pageAccount);
    }
}
